import asyncio

from bs4 import BeautifulSoup

from pyppeteer_util.video_file_scraper import VideoFileScraper
from service.task_video_service import TaskVideoService

task_video_service = TaskVideoService()
async def get_remote_video_path():
    video_list = task_video_service.get_null_task_videos()
    if video_list:
        for video in video_list:
            print(video)
            url = video.site_url + video.video_url
            scraper = VideoFileScraper(url)
            video.path = await scraper.start()
            if video.video_url:
                task_video_service.update_video_path(video.id, video.path)


if __name__ == '__main__':
    asyncio.run(get_remote_video_path())

